# -*- coding: utf-8 -*-
import top.api
appkey='23765117'
secret='d17fa01404d4e29b0678604a141b43fa'

def sendTemplateSMS(to, datas, tempId):
    req = top.api.AlibabaAliqinFcSmsNumSendRequest()
    req.set_app_info(top.appinfo(appkey,secret))
    req.extend = ""
    req.sms_type = "normal"
    req.sms_free_sign_name = "桂票网"
    req.sms_param = "{captcha:'%s',times:'%s'}"%(datas[0],datas[1])
    req.rec_num = str(to)
    if tempId==1:
        req.sms_template_code = "SMS_114575014"
    elif tempId==2:
        req.sms_template_code = "SMS_114455012"
    try :
         resp = req.getResponse()
         print (resp)
    except Exception,e:
         print (e)

if __name__=='__main__':
    sendTemplateSMS('18878730803', [9999,30], 1)